<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   template="/WEB-INF/templates/default.xhtml">
   <ui:define name="content">
      <h1>Sheetmusic Archive (beta)</h1>

      <h:form id="reg">
         <h2>Register Band</h2>
         
         <table>
            <tr>
               <th style="text-align: right;"><h:outputLabel
                     for="name" value="Name:" /></th>
               <td><h:inputText id="name" value="#{newBand.name}" />
                  <h:message for="name" errorClass="invalid" /></td>
            </tr>
            <tr>
               <th style="text-align: right;"><h:outputLabel
                     for="email" value="City:" /></th>
               <td><h:inputText id="city"
                     value="#{newBand.city}" /> <h:message
                     for="city" errorClass="invalid" /></td>
            </tr>
 
         </table>
         <p>
            <h:commandButton id="register"
               action="#{bandRegistration.register}" value="Add" />
            <h:outputText value=" Registered!"
               rendered="#{facesContext.postback and empty facesContext.messageList}"
               style="color: green;" />
         </p>
      </h:form>
      <h2>Members</h2>
      <h:panelGroup rendered="#{empty bands}">
         <em>No registered members.</em>
      </h:panelGroup>
      <h:dataTable var="_band" value="#{bands}"
         rendered="#{not empty members}">
         <h:column>
            <f:facet name="header">Id</f:facet>
                #{_band.id}
            </h:column>
         <h:column>
            <f:facet name="header">Name</f:facet>
                #{_band.name}
            </h:column>
         <h:column>
            <f:facet name="header">City</f:facet>
                #{_band.city}
            </h:column>
         <h:column>
             <h:column>
            <f:facet name="header">REST URL</f:facet>
            <a href="#{request.contextPath}/rest/bands/#{_band.id}">/rest/members/#{_member.id}</a>
         </h:column>
         <f:facet name="footer">
                REST URL for all bands: <a
               href="#{request.contextPath}/rest/bands">/rest/bands</a>
         </f:facet>
      </h:dataTable>
   </ui:define>
</ui:composition>
